home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et-2_2.lha / et2.2 / src / SeqColl.C < prev    next >
C/C++ Source or Header  |  1990-09-25  |  2KB  |  126 lines

  1. //$SeqCollection$
  2. #include "SeqColl.h"
  3.  
  4. AbstractMetaImpl0(SeqCollection);
  5.  
  6. SeqCollection::SeqCollection()
  7. {
  8. }
  9.  
  10. void SeqCollection::InsertBefore(ObjPtr, ObjPtr)
  11. {
  12.     AbstractMethod("InsertBefore");
  13. }
  14.  
  15. void SeqCollection::InsertAfter(ObjPtr, ObjPtr)
  16. {
  17.     AbstractMethod("InsertAfter");
  18. }
  19.  
  20. void SeqCollection::InsertBeforePtr(ObjPtr, ObjPtr)
  21. {
  22.     AbstractMethod("InsertBeforePt");
  23. }
  24.  
  25. void SeqCollection::InsertAfterPtr(ObjPtr, ObjPtr)
  26. {
  27.     AbstractMethod("InsertAfterPtr");
  28. }
  29.  
  30. ObjPtr SeqCollection::Before(ObjPtr)
  31. {
  32.     AbstractMethod("Before");
  33.     return 0;
  34. }
  35.  
  36. ObjPtr SeqCollection::After(ObjPtr)
  37. {
  38.     AbstractMethod("After");
  39.     return 0;
  40. }
  41.  
  42. ObjPtr SeqCollection::First()
  43. {
  44.     AbstractMethod("First");
  45.     return 0;
  46. }
  47.  
  48. ObjPtr SeqCollection::Last()
  49. {
  50.     AbstractMethod("Last");
  51.     return 0;
  52. }
  53.  
  54. void SeqCollection::AddFirst(ObjPtr op)
  55. {
  56.     ObjPtr first= First();
  57.     if (first)
  58.     InsertBefore(first, op);
  59.     else
  60.     Add(op);
  61. }
  62.     
  63. void SeqCollection::AddLast(ObjPtr op)
  64. {
  65.     ObjPtr last = Last();
  66.     if (last)
  67.     InsertAfter(last,op);
  68.     else
  69.     Add(op);
  70. }
  71.  
  72. ObjPtr SeqCollection::RemoveFirst()
  73. {
  74.     ObjPtr first = First();
  75.     return first ? RemovePtr(first) : 0;
  76. }
  77.     
  78. ObjPtr SeqCollection::RemoveLast()
  79. {
  80.     ObjPtr last = Last();
  81.     return last ? RemovePtr(last) : 0;
  82. }
  83.  
  84. int SeqCollection::IndexOf(ObjPtr anOp)
  85. {
  86.     Iter next(this);
  87.     register ObjPtr op;
  88.     register int s;
  89.     
  90.     if (anOp == 0)
  91.     return -1;
  92.     for (s = 0; op = next(); ) {
  93.     if (!op->IsDeleted()) {
  94.         if (op->IsEqual(anOp))
  95.         break;
  96.         s++;
  97.     }
  98.     }
  99.     return op == 0 ? -1 : s;
  100. }    
  101.  
  102. int SeqCollection::IndexOfPtr(ObjPtr anOp)
  103. {
  104.     Iter next(this);
  105.     register ObjPtr op;
  106.     register int s;
  107.     
  108.     if (anOp == 0)
  109.     return -1;
  110.     for (s = 0; op = next(); s) {
  111.     if (!op->IsDeleted()) {
  112.         if (op == anOp)
  113.         break;
  114.         s++;
  115.     }
  116.     }
  117.     return op == 0 ? -1 : s;
  118.  
  119. Iterator *SeqCollection::MakeReversedIterator()
  120. {
  121.     AbstractMethod("MakeReversedIterator");
  122.     return 0;
  123. }
  124.  
  125.